package IC.Parser;

import java_cup.runtime.Symbol;

public class Token extends Symbol {
	int _id;
	int _line;
	boolean _valExists = false;
	String _tokenName;
	
	public Token(int id, String tokenName, int line) 
	{
		this(id, tokenName, line, null);
	}
	
	public Token(int id, String tokenName, int line, String value) 
	{
		super(id, line, 0 ,value);
		
		_line = line;
		_valExists = value != null;
		_tokenName = tokenName;
		_id = id;
		_line = line;
	}

	public int getId() {
		return _id;
	}

	public int getLine() {
		return _line;
	}

	public String toString() {
			return (_valExists == true) ? String.format("%s(%s)", _tokenName, value)
								    	: String.format("%s", _tokenName);
		
	}
}
